home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / hamilton.doc < prev    next >
Text File  |  1995-03-31  |  10KB  |  213 lines

  1. (Comp.sys.hp48) 
  2. Item: 693 by charliep@hpcvra.cv.hp.com. [Charles Patton] 
  3. Subj: Hamiltonian Method for Geodesics 
  4. Date: Wed Feb 19 1992 
  5.  
  6. @ Version 1.0 @ 
  7.  
  8. _Introduction_ 
  9.  
  10.      The programs contained in this document comprise a collection 
  11. of simple-minded utilities for use in computing approximate orbits 
  12. of Hamiltonian dynamical systems in three space variables. 
  13.  
  14.      These utilites are the outcome of messing around with ways of 
  15. computing geodesics on implicitly-defined surfaces embedded in Euclidean 
  16. space. There is nothing new about the method involved, rather, the nicest 
  17. thing is how easy it is to "follow your nose" when working in an 
  18. environment like that of the '48. 
  19.  
  20.      All suggestions, additions, corrections, insights, commentary, 
  21. and criticisms are welcome. 
  22.  
  23. _NO WARRANTY_ 
  24.     This work is provided on an "as is" basis. Hewlett-Packard Co. 
  25. provides no warranty whatsoever, either express or implied regarding 
  26. the work, including warranties with respect to its merchantability or 
  27. fitness for any purpose whatsoever. 
  28.  
  29. _Copyright_ 
  30.    Copyright (C), 1991, Hewlett-Packard Co. Permission to copy all or 
  31. part of this work is granted provided that the copies are not made or 
  32. distributed for resale (excepting nominal copying fees) and the 
  33.  _NO WARRANTY_ and this copyright notice are included verbatim. Other 
  34. permissions can be arranged by contacting the author. 
  35.  
  36. _Correspondence_ 
  37.  
  38.    Correspondence on HamiltonGeodesy should be sent to Charles Patton 
  39. at one of the following addresses: 
  40.  
  41. snail-mail: 
  42.           M.S. 5U-L9 
  43.           Hewlett-Packard Co. 
  44.           1000 N.E. Circle Blvd. 
  45.           Corvallis, OR 97330 
  46.  
  47. e-mail: 
  48.           charliep@cv.hp.com    (for Internet hosts) 
  49.           hplabs!hpcvrs!charliep (for UUCP hosts) 
  50.  
  51. _Overview_ 
  52.  
  53.      Recall that the Hamilton-Jacobi formulation of classical mechanics 
  54. starts with the energy function ("Hamiltonian") as a function of position 
  55. and momentum of the system in question: q,p --> H(q,p). The Hamilton 
  56. equations then say that the time derivative of the position is the 
  57. derivative of H with respect to momentum, and the time derivative of 
  58. the momentum is the negative of the derivative of H with respect to 
  59. the position: q'=dH/dp ; p'=-dH/dq. The orbits of the Hamiltonian are 
  60. the integral curves of this system of differential equations, that is, 
  61. curves q(t),p(t) which satisfy dq/dt=dH/dp and dp/dt=-dH/dq. 
  62.  
  63.     Perhaps the simplest way to formulate the problem of finding 
  64. geodesics on a Riemannian space is as a Hamiltonian system. In this case, 
  65. the Hamiltonian is just the function which assigns to a position and 
  66. momentum half the squared length (according to the local metric) of the 
  67. momentum: 
  68.  
  69. H(q,p)=0.5 Sum g  (q) p  p 
  70.             i,j ij     i  j 
  71.  
  72. where g(q) is the metric at q. In this case, the projection onto 
  73. position space of the orbits of the Hamiltonian are the geodesics. 
  74.  
  75.     If we are trying to find geodesics on a surface emdedded in 
  76. Euclidean space, we could find local coordinates for the surface, 
  77. compute the metric in local coordinates, and then use the above 
  78. formulation to find geodesics in terms of these local coordinates. 
  79. This is almost always difficult to do. 
  80.  
  81.     We will take a different approach here, the key difference being 
  82. that we are assuming that the surface is given to us as the zero-set 
  83. of a function F: q --> F(q) defined on the Euclidean space. We can use 
  84. F to define a potential function on the Euclidean space with a minimum 
  85. along the desired surface and use the Euclidean metric together to define 
  86. the Hamiltonian: 
  87.  
  88.           2    2          2 
  89. H(q,p)=k F(q) +0.5 ||p|| 
  90.  
  91. for some "large" constant, k. 
  92.  
  93.     If we start with any initial q,p with F(q)=0 and p "tangent" to 
  94. the the surface, the projection onto position space of the resulting 
  95. orbit will approximate a geodesic on the desired surface. You can 
  96. think of this as describing a particle attached to the surface by a 
  97. sliding, frictionless spring. If the spring is very stiff, the 
  98. particle will follow the path of a geodesic when it is given a shove 
  99. along the surface. If the spring is not so stiff, the particle will 
  100. combine near-geodesic motion with oscillations normal to the surface. 
  101.  
  102. _Organization and Descriptions of the Programs_ 
  103.  
  104.     The utilities are arranged in a directory with the two top-level 
  105. programs first, and the supporting utilities and variables afterwords. 
  106. The space coordinates are represented by the variables, 'x' 'y' and 'z' 
  107. (note the lower case.) The corresponding momentum coordinates are 'px' 
  108. 'py' and 'pz'. 
  109.  
  110. SetUpHamiltonian: 
  111.     Given the function kF, on the stack, as an expression in the space 
  112. variables, 'x' 'y' and 'z', this program creates the Hamiltonian 
  113. described above and stores it in the variable 'H' for future 
  114. reference. It then computes the components, 'xdot'...'pzdot', 
  115. corresponding to the Hamiltonian equations. It then calls on the 
  116. utility Lie4thOrder to compute a (formal) fourth order polynomial 
  117. approximation to the solution of the system of Hamilton equations, 
  118. storing the formulae for the increments as '<delta>x'...'<delta>pz'. 
  119. This takes a loooong time so go out for a coffee break after firing it 
  120. up. 
  121.  
  122. After this finishes, you are ready to plot approximate geodesics on your 
  123. surface. 
  124.  
  125.     You can easily customize this program to set up for an arbitrary 
  126. Hamiltonian in these variables by deleting the first line of the 
  127. program listed, below, and storing your choice of Hamiltonian (as an 
  128. expression in 'x'...'pz') in the variable 'H' before running 
  129. SetUpHamiltonian. 
  130.  
  131. N.B.>Insure that 'x' 'y' 'z' 'px' 'py' and 'pz' are formal (no variables 
  132. N.B.>with those names along the current path.) 
  133.  
  134. N.B.> Examine the MODES menu to be sure that the 
  135. N.B.> the machine is in SYMBOLIC EVALUATION mode ( SYM button.) 
  136.  
  137. RunHamiltonian: 
  138.     This program takes initial values for x y z px py and pz on the 
  139. stack and computes successive points (approximately) on the orbit of 
  140. the Hamiltonian. It graphs these by lines connecting successive (x,z) 
  141. pairs (i.e. projection of the orbit on the x-z plane) using the 
  142. current PPAR values for the horizontal and vertical scaling of the 
  143. screen. It requires that you have previously run SetUpHamiltonian in 
  144. the current directory. 
  145.  
  146.     As part of its initialization, it takes the current value of the 
  147. stepsize (stored in the variable <delta>) and pre-computes the higher 
  148. order stepsizes (<delta>^2/2, <delta>^3/6, and <delta>^4/24) storing 
  149. these in <delta>2 <delta>3 and <delta>4. As explained below, the 
  150. default value of <delta> is 0.1, but you can use any value you wish as 
  151. long as you store it before running this program. 
  152.  
  153.     You should exit this program by pressing the [ENTER] key. When 
  154. this is done, the program will clean up and leave the last computed 
  155. values of x...pz on the stack ready for continuation of the orbit, if 
  156. desired. 
  157.  
  158. HamiltonStep: 
  159.     This simple utility takes the values off the stack, stores them 
  160. in 'x'...'pz', computes the next step and returns the values to the 
  161. stack. 
  162.  
  163. Lie4thOrder: 
  164.     This routine constitutes the heart of this collection of 
  165. utilities.  The idea is that applying the Lie derivative operator 
  166.  
  167.      d      d      d       d      d      d 
  168. L:=x'-  + y'-  + z'-  + px'- + py'- + pz'- 
  169.      dx     dy     dz     dpx    dpy    dpz 
  170.  
  171. to any function, f, corresponds to taking the time derivative of f 
  172. along the orbits of the Hamiltonian. Thus, the fourth-order Taylor 
  173. series approximation to the time evolution of f is 
  174.  
  175.     f+(Lf)t+(LLf)t^2/2+(LLLf)t^3/6+(LLLLf)t^4/24 
  176.  
  177.     Using this on each of the coordinate functions, x...pz, thus gives 
  178. an approximation to the orbits themselves. This program computes this 
  179. approximation for each of the coordinate functions using <delta> as 
  180. the time-step, t. This is equivalent (in the limit of small time-step) 
  181. to the fourth-order Runge-Kutte method of approximating solutions to 
  182. ordinary differential equations, but has the advantage of being much 
  183. more comprehensible. It also allows you to compute the approximate 
  184. time evolution of any smooth function, not just the coordinate 
  185. functions, in exactly the same manner. 
  186.  
  187.    The resulting approximation is subject to the same kinds of 
  188. instabilities as the R-K method. In our case, this shows up when the 
  189. approximation overshoots into a region where the added potential is 
  190. steep. This causes the next step to overshoot even more in the other 
  191. direction, quickly leading to huge values for the position and 
  192. momentum coordinates. For this reason, you should leave <delta> at its 
  193. default value, and if instabilites become apparent, choose a smaller 
  194. value for the initial velocity. The point here being that while the 
  195. space-projection of the orbits of the geodesic equation don't depend 
  196. on the initial velocity, the orbits of our approximation do. They are 
  197. only asymptotic to the geodesics in the limit of small initial 
  198. velocity. Moreover, no choice of potential will fix that. You can 
  199. think of it like a motorcycle driving in a groove. At low velocity, it 
  200. will follow the groove nicely, but at high velocity, it will "bank" 
  201. its turns on the wall of the groove, hence the possibility for 
  202. overshoot becomes more serious. 
  203.  
  204. LieDer: 
  205.     This utility takes a function, given as an expression in x...pz, 
  206. and computes its Lie derivative according to the current values of 
  207. 'xdot'...'pzdot' which correspond to x'...pz'. 
  208.  
  209. The Other Variables: 
  210.     <delta>...<delta>4 and 'H' were explained previously. The others 
  211. are placeholders for values computed during the operations of the 
  212. main programs. 
  213.